<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
<title>Spring Security – Using custom Authentication Processing Filter « Tejakantamneni’s Weblog</title>

<link rel="stylesheet" href="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/style_002.css" type="text/css" media="screen">
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://s2.wp.com/wp-content/themes/pub/inuit-types/ie.css?m=1342362678g" type="text/css" media="screen" />
<![endif]-->

<!--[if lte IE 6]>
<link rel="stylesheet" href="http://s2.wp.com/wp-content/themes/pub/inuit-types/ie6.css?m=1270732991g" type="text/css" media="screen" />
<![endif]-->
<link rel="pingback" href="http://tejakantamneni.wordpress.com/xmlrpc.php">


<link rel="alternate" type="application/rss+xml" title="Tejakantamneni's Weblog » Feed" href="http://tejakantamneni.wordpress.com/feed/">
<link rel="alternate" type="application/rss+xml" title="Tejakantamneni's Weblog » Comments Feed" href="http://tejakantamneni.wordpress.com/comments/feed/">
<link rel="alternate" type="application/rss+xml" title="Tejakantamneni's Weblog » Spring Security – Using custom Authentication Processing&nbsp;Filter Comments Feed" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/feed/">
<script type="text/javascript" async="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/quant.js"></script><script type="text/javascript">
/* <![CDATA[ */
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}
/* ]]> */
</script>
<link rel="stylesheet" id="all-css-0" href="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/a.css" type="text/css" media="all">
<link rel="stylesheet" id="print-css-0" href="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/global-print.css" type="text/css" media="print">
<script type="text/javascript">
/* <![CDATA[ */
var LoggedOutFollow = {"invalid_email":"Your subscription did not succeed, please try again with a valid email address."};
/* ]]> */
</script>
<script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/a.js"></script>
<link rel="stylesheet" id="all-css-0" href="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/style.css" type="text/css" media="all">
<!--[if lt IE 8]>
<link rel='stylesheet' id='highlander-comments-ie7-css'  href='http://s2.wp.com/wp-content/mu-plugins/highlander-comments/style-ie7.css?m=1307172283g&#038;ver=20110606' type='text/css' media='all' />
<![endif]-->
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://tejakantamneni.wordpress.com/xmlrpc.php?rsd">
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://tejakantamneni.wordpress.com/wp-includes/wlwmanifest.xml"> 
<link rel="next" title="Testing Spring applications with jUnit 4 and Easy&nbsp;Mock" href="http://tejakantamneni.wordpress.com/2008/08/24/testing-spring-applications-with-junit-4-and-easy-mock/">
<meta name="generator" content="WordPress.com">
<link rel="canonical" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/">
<link rel="shortlink" href="http://wp.me/pjk7p-3">
<link rel="alternate" type="application/json+oembed" href="http://public-api.wordpress.com/oembed/1.0/?format=json&amp;url=http%3A%2F%2Ftejakantamneni.wordpress.com%2F2008%2F08%2F23%2Fspring-security-using-custom-authentication-processing-filter%2F&amp;for=wpcom-auto-discovery"><link rel="alternate" type="application/xml+oembed" href="http://public-api.wordpress.com/oembed/1.0/?format=xml&amp;url=http%3A%2F%2Ftejakantamneni.wordpress.com%2F2008%2F08%2F23%2Fspring-security-using-custom-authentication-processing-filter%2F&amp;for=wpcom-auto-discovery"><meta property="og:type" content="article">
<meta property="og:title" content="Spring Security – Using custom Authentication Processing&nbsp;Filter">
<meta property="og:url" content="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/">
<meta property="og:description" content="Recently I got a chance working with Spring security, formerly known as Acegi Security for spring. While working with the framework, I heard comments from friends and colleagues saying that spring ...">
<meta property="og:site_name" content="Tejakantamneni's Weblog">
<meta name="twitter:card" content="summary">
<meta property="fb:app_id" content="249643311490">
<link rel="shortcut icon" type="image/x-icon" href="http://s2.wp.com/i/favicon.ico?m=1311976023g" sizes="16x16 24x24 32x32 48x48">
<link rel="icon" type="image/x-icon" href="http://s2.wp.com/i/favicon.ico?m=1311976023g" sizes="16x16 24x24 32x32 48x48">
<link rel="apple-touch-icon-precomposed" href="http://s0.wp.com/i/webclip.png?m=1311618091g">
<link rel="openid.server" href="http://tejakantamneni.wordpress.com/?openidserver=1">
<link rel="openid.delegate" href="http://tejakantamneni.wordpress.com/">
<link rel="search" type="application/opensearchdescription+xml" href="http://tejakantamneni.wordpress.com/osd.xml" title="Tejakantamneni's Weblog">
<link rel="search" type="application/opensearchdescription+xml" href="http://wordpress.com/opensearch.xml" title="WordPress.com">
		<style>
		/* <![CDATA[ */
		/* Block: reblog */
		
		.reblog-from img                   { margin: 0 10px 0 0; vertical-align: middle; padding: 0; border: 0; }
		.reblogger-note img.avatar         { float: left; padding: 0; border: 0; }
		.reblogger-note-content            { margin: 0 0 20px; }
		.reblog-post .wpcom-enhanced-excerpt-content { border-left: 3px solid #eee; padding-left: 15px; }
		.reblog-post ul.thumb-list         { display: block; list-style: none; margin: 2px 0; padding: 0; clear: both; }
		.reblog-post ul.thumb-list li      { display: inline; margin: 0; padding: 0 1px; border: 0; }
		.reblog-post ul.thumb-list li a    { margin: 0; padding: 0; border: 0; }
		.reblog-post ul.thumb-list li img  { margin: 0; padding: 0; border: 0; }
		
		.reblog-post .wpcom-enhanced-excerpt { clear: both; }
		
		.reblog-post .wpcom-enhanced-excerpt address,
		.reblog-post .wpcom-enhanced-excerpt li,
		.reblog-post .wpcom-enhanced-excerpt h1,
		.reblog-post .wpcom-enhanced-excerpt h2,
		.reblog-post .wpcom-enhanced-excerpt h3,
		.reblog-post .wpcom-enhanced-excerpt h4,
		.reblog-post .wpcom-enhanced-excerpt h5,
		.reblog-post .wpcom-enhanced-excerpt h6,
		.reblog-post .wpcom-enhanced-excerpt p { font-size: 100% !important; }
		
		.reblog-post .wpcom-enhanced-excerpt blockquote,
		.reblog-post .wpcom-enhanced-excerpt pre,
		.reblog-post .wpcom-enhanced-excerpt code,
		.reblog-post .wpcom-enhanced-excerpt q { font-size: 98% !important; }
		

		/* ]]> */		
		</style>
				<link href="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/1-default.css" rel="stylesheet" type="text/css">
	<meta name="application-name" content="Tejakantamneni's Weblog"><meta name="msapplication-window" content="width=device-width;height=device-height"><meta name="msapplication-tooltip" content="A compilation of my thoughts and lessons learnt"><meta name="msapplication-task" content="name=Subscribe;action-uri=http://tejakantamneni.wordpress.com/feed/;icon-uri=http://s2.wp.com/i/favicon.ico"><meta name="msapplication-task" content="name=Sign up for a free blog;action-uri=http://wordpress.com/signup/;icon-uri=http://s2.wp.com/i/favicon.ico"><meta name="msapplication-task" content="name=WordPress.com Support;action-uri=http://support.wordpress.com/;icon-uri=http://s2.wp.com/i/favicon.ico"><meta name="msapplication-task" content="name=WordPress.com Forums;action-uri=http://forums.wordpress.com/;icon-uri=http://s2.wp.com/i/favicon.ico"><meta name="title" content="Spring Security – Using custom Authentication Processing&nbsp;Filter | Tejakantamneni's Weblog on WordPress.com">
<meta name="description" content="Recently I got a chance working with Spring security, formerly known as Acegi Security for spring. While working with the framework, I heard comments from friends and colleagues saying that spring security lacks proper documentation. So thought of sharing a little knowledge. By the way, this is first ever blog posting and kindly excuse me…">

<link rel="stylesheet" type="text/css" id="gravatar-card-css" href="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/hovercard.css"><link rel="stylesheet" type="text/css" id="gravatar-card-services-css" href="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/services.css"></head>

<body data-twttr-rendered="true" class="single single-post postid-3 single-format-standard highlander-enabled highlander-light">

	<div class="wrapper">
	
	<div id="main_menu" class="top_menu">

	    <div class="fl">

		    <div class="menu"><ul><li class="page_item page-item-2"><a href="http://tejakantamneni.wordpress.com/about/">About</a></li></ul></div>

	    </div>


	    <div class="fr">

			<span class="subscribe">

			<a href="http://tejakantamneni.wordpress.com/feed/"><span class="rss-button">RSS</span></a> &nbsp;Subscribe:&nbsp;

			<a href="http://tejakantamneni.wordpress.com/feed/">RSS feed</a>

			</span>

	    </div>

	</div><!-- #main_menu -->


		<div class="container">

			<div id="inuit-content" class="content content_left">

								<div id="header">

			            <div class="blog-title"><a href="http://tejakantamneni.wordpress.com/">Tejakantamneni’s Weblog</a></div>

		                <div class="blog-description">A compilation of my thoughts and lessons learnt</div>

				</div>

		
			
				<div id="post-3" class="post-3 post type-post status-publish format-standard hentry category-acegi category-spring-security category-springframework single-post">

					<div id="header-about">

	                <h1>Spring Security – Using custom Authentication Processing&nbsp;Filter </h1>

	                </div>

					<div class="date-comments">

				    <p class="fl">


					    <em>Posted on August 23, 2008</em>

					    
					</p>

				    <p class="fr"><span class="comments">

					    
		                      <a href="#comments">20</a>

						
					</span></p>

			        </div>

					<div class="clear"></div>

					<br>

					<div class="entry">

	                	
						<p>Recently I got a chance working with  Spring security, formerly
 known as Acegi Security for spring. While working with the framework, I
 heard comments from friends and colleagues saying that spring security 
lacks proper documentation. So thought of sharing a little knowledge. By
 the way, this is first ever blog posting and kindly excuse me and let 
me know any errors and improvements.</p>
<p>Spring security offers a simple configuration based security for your
 web applications helping you secure your web application with out 
littering your business logic with any security code. It provides 
securing URL’s based on the Role (Authorities), securing your business 
methods based on the ACL’s.</p>
<p>The first step in hooking up the spring security to your web 
application is by specifying the DelegatingFilterProxy in your web.xml.</p>
<div class="xml xml" style="border:1px solid rgb(208, 208, 208);color:rgb(0, 0, 102);background-color:rgb(240, 240, 240);font-family:monospace;">
<ol>
<li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–Spring security filter–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;filter<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;filter-name<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>springSecurityFilterChain<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/filter-name<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;filter-class<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>org.springframework.web.filter.DelegatingFilterProxy<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/filter-class<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/filter</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);"> <span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;filter-mapping<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;filter-name<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>springSecurityFilterChain<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/filter-name<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;url-pattern<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>/*<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/url-pattern<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;dispatcher<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>REQUEST<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/dispatcher<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;dispatcher<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>INCLUDE<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/dispatcher<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;dispatcher<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>FORWARD<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/dispatcher<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/filter-mapping<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–End spring security filter–&gt;</span></div>
</li>
<p></p></ol>
</div>
<p>If you want to externalize all of your security related configuration
 into a separate file, you can do so and add that to your context 
location param.
</p><div class="xml xml" style="border:1px solid rgb(208, 208, 208);color:rgb(0, 0, 102);background-color:rgb(240, 240, 240);font-family:monospace;">
<ol>
<li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;context-param<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;param-name<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span>contextConfigLocation<span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/param-name<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">        <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;param-value<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">                /WEB-INF/beans.xml , /WEB-INF/springSecurity.xml <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/param-value<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/context-param<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p></p></ol>
</div>
<p>Now comes the part of security configuration for your application, 
Adding the URL security patterns is pretty simple and straight forward. 
Add all the URL patterns which you want to secure and add the wild card 
pattern at the end. You need to have some default principal and role 
even for non logged in users as you need to give access to pages like 
log in, register and forgot password kind of functionality even to non 
logged in users.</p>
<p>I tried to add comments to pretty much every element which I am using here.<br>As
 an example I added just a wild card intercept url which make every page
 of my application secure. You need to exclude different urls based on 
the roles.</p>
<div class="xml xml" style="border:1px solid rgb(208, 208, 208);color:rgb(0, 0, 102);background-color:rgb(240, 240, 240);font-family:monospace;">
<ol>
<li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(128, 128, 128);font-style:italic;"><!--enabling spring secuirty with custom authuntication--></span></div>
<p></p></li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:http</span> <span style="color:rgb(0, 0, 102);">entry-point-ref</span>=<span style="color:rgb(255, 0, 0);">“myAuthenticationEntryPoint”</span> <span style="color:rgb(0, 0, 102);">session-fixation-protection</span>=<span style="color:rgb(255, 0, 0);">“newSession”</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–add any of your cusotom url patterns to protect–&gt;</span></div>
</li>
<li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:intercept-url</span> <span style="color:rgb(0, 0, 102);">pattern</span>=<span style="color:rgb(255, 0, 0);">“/login/**”</span> <span style="color:rgb(0, 0, 102);">access</span>=<span style="color:rgb(255, 0, 0);">“ROLE_ANONYMOUS”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:intercept-url</span> <span style="color:rgb(0, 0, 102);">pattern</span>=<span style="color:rgb(255, 0, 0);">“/register/**”</span> <span style="color:rgb(0, 0, 102);">access</span>=<span style="color:rgb(255, 0, 0);">“ROLE_ANONYMOUS”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:intercept-url</span> <span style="color:rgb(0, 0, 102);">pattern</span>=<span style="color:rgb(255, 0, 0);">“/**”</span> <span style="color:rgb(0, 0, 102);">access</span>=<span style="color:rgb(255, 0, 0);">“ROLE_USER”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:logout</span> <span style="color:rgb(0, 0, 102);">logout-success-url</span>=<span style="color:rgb(255, 0, 0);">“/home.htm”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:anonymous</span> <span style="color:rgb(0, 0, 102);">username</span>=<span style="color:rgb(255, 0, 0);">“guest”</span> <span style="color:rgb(0, 0, 102);">granted-authority</span>=<span style="color:rgb(255, 0, 0);">“ROLE_ANONYMOUS”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/security:http<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–name of my authenticationManager is authenticationManager–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:authentication-manager</span> <span style="color:rgb(0, 0, 102);">alias</span>=<span style="color:rgb(255, 0, 0);">“authenticationManager”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–Cutom login filter which replaces the default AUTHENTICATION_PROCESSING_FILTER –&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;bean</span> <span style="color:rgb(0, 0, 102);">id</span>=<span style="color:rgb(255, 0, 0);">“customizedFormLoginFilter”</span> <span style="color:rgb(0, 0, 102);">class</span>=<span style="color:rgb(255, 0, 0);">“org.springframework.security.ui.webapp.AuthenticationProcessingFilter”</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;security:custom-filter</span> <span style="color:rgb(0, 0, 102);">position</span>=<span style="color:rgb(255, 0, 0);">“AUTHENTICATION_PROCESSING_FILTER”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span><span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–replace the default one–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;property</span> <span style="color:rgb(0, 0, 102);">name</span>=<span style="color:rgb(255, 0, 0);">“defaultTargetUrl”</span> <span style="color:rgb(0, 0, 102);">value</span>=<span style="color:rgb(255, 0, 0);">“/main.htm”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span><span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–After a successful login, the user will be taken to this page–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;property</span> <span style="color:rgb(0, 0, 102);">name</span>=<span style="color:rgb(255, 0, 0);">“authenticationFailureUrl”</span> <span style="color:rgb(0, 0, 102);">value</span>=<span style="color:rgb(255, 0, 0);">“/home.htm?error=true”</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span><span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–Authentication failed? take him to error page–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;property</span> <span style="color:rgb(0, 0, 102);">name</span>=<span style="color:rgb(255, 0, 0);">“authenticationManager”</span> <span style="color:rgb(0, 0, 102);">ref</span>=<span style="color:rgb(255, 0, 0);">“myAuthenticationManager”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span> <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–Here it is the custom authenticationManager, login magic goes here –&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;property</span> <span style="color:rgb(0, 0, 102);">name</span>=<span style="color:rgb(255, 0, 0);">“allowSessionCreation”</span> <span style="color:rgb(0, 0, 102);">value</span>=<span style="color:rgb(255, 0, 0);">“true”</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span> <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–Allow the application to create sessions–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/bean<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–My custom auth manager–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;bean</span> <span style="color:rgb(0, 0, 102);">id</span>=<span style="color:rgb(255, 0, 0);">“myAuthenticationManager”</span> <span style="color:rgb(0, 0, 102);">class</span>=<span style="color:rgb(255, 0, 0);">“com.teja.security.CustomAuthunticationManager”</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!– Automatically receives AuthenticationEvent messages –&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;bean</span> <span style="color:rgb(0, 0, 102);">id</span>=<span style="color:rgb(255, 0, 0);">“loggerListener”</span> <span style="color:rgb(0, 0, 102);">class</span>=<span style="color:rgb(255, 0, 0);">“org.springframework.security.event.authentication.LoggerListener”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(128, 128, 128);font-style:italic;">&lt;!–My authuntication entry point, can be replaced easily if we are doing custom commence of invalid auths.–&gt;</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;bean</span> <span style="color:rgb(0, 0, 102);">id</span>=<span style="color:rgb(255, 0, 0);">“myAuthenticationEntryPoint”</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);"> <span style="color:rgb(0, 0, 102);">class</span>=<span style="color:rgb(255, 0, 0);">“com.teja.security.CustomAuthenticationEntryPoint”</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;">         <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;property</span> <span style="color:rgb(0, 0, 102);">name</span>=<span style="color:rgb(255, 0, 0);">“loginFormUrl”</span> <span style="color:rgb(0, 0, 102);">value</span>=<span style="color:rgb(255, 0, 0);">“/home.htm”</span><span style="color:rgb(0, 0, 0);font-weight:bold;">/&gt;</span></span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);"><span style="color:rgb(0, 0, 0);font-weight:bold;">&lt;/bean<span style="color:rgb(0, 0, 0);font-weight:bold;">&gt;</span></span></span></div>
</li>
<p></p></ol>
</div>
<p>Following is my custom implementation of AuthenticationEntryPoint, 
which currently is not doing any thing except leveraging the commence to
 its super class which is the spring implementation of  
AuthenticationProcessingFilterEntryPoint. I hooked it to add any custom 
logic.</p>
<div class="java java" style="border:1px solid rgb(208, 208, 208);color:rgb(0, 0, 102);background-color:rgb(240, 240, 240);font-family:monospace;">
<ol>
<li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 0, 0);font-weight:bold;">public</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">class</span> CustomAuthenticationEntryPoint <span style="color:rgb(0, 0, 0);font-weight:bold;">extends</span> AuthenticationProcessingFilterEntryPoint <span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">private</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">static</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">final</span> Log logger <span style="color:rgb(51, 153, 51);">=</span> LogFactory.<span style="color:rgb(0, 102, 51);">getLog</span><span style="color:rgb(0, 153, 0);">(</span>CustomAuthenticationEntryPoint.<span style="color:rgb(0, 0, 0);font-weight:bold;">class</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> </div>
<p></p></li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> @Override</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">public</span> <span style="color:rgb(0, 0, 102);font-weight:bold;">void</span> commence<span style="color:rgb(0, 153, 0);">(</span>ServletRequest request, ServletResponse response, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aauthenticationexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">AuthenticationException</span></a> authException<span style="color:rgb(0, 153, 0);">)</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">IOException</span></a>, ServletException <span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">super</span>.<span style="color:rgb(0, 102, 51);">commence</span><span style="color:rgb(0, 153, 0);">(</span>request, response, authException<span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p></p></ol>
</div>
<p>This is my custom authentication manager which actually does the 
custom login of the user. It will throw an BadCredentialsException in 
case of invalid credentials or thorws a AuthenticationServiceException 
in case of a service error (Database error, SQL error or any other 
error).</p>
<div class="java java" style="border:1px solid rgb(208, 208, 208);color:rgb(0, 0, 102);background-color:rgb(240, 240, 240);font-family:monospace;">
<ol>
<li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"><span style="color:rgb(0, 0, 0);font-weight:bold;">public</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">class</span> CustomAuthunticationManager <span style="color:rgb(0, 0, 0);font-weight:bold;">implements</span> AuthenticationManager <span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> @Autowired</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> UserManagerService userManagerService;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">public</span> Authentication authenticate<span style="color:rgb(0, 153, 0);">(</span>Authentication authentication<span style="color:rgb(0, 153, 0);">)</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aauthenticationexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">AuthenticationException</span></a> <span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">if</span><span style="color:rgb(0, 153, 0);">(</span>StringUtils.<span style="color:rgb(0, 102, 51);">isBlank</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">(</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">String</span></a><span style="color:rgb(0, 153, 0);">)</span> authentication.<span style="color:rgb(0, 102, 51);">getPrincipal</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">)</span> || StringUtils.<span style="color:rgb(0, 102, 51);">isBlank</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">(</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">String</span></a><span style="color:rgb(0, 153, 0);">)</span> authentication.<span style="color:rgb(0, 102, 51);">getCredentials</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">throw</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">new</span> BadCredentialsException<span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 0, 255);">“Invalid username/password”</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> User user <span style="color:rgb(51, 153, 51);">=</span> <span style="color:rgb(0, 0, 102);font-weight:bold;">null</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> GrantedAuthority<span style="color:rgb(0, 153, 0);">[</span><span style="color:rgb(0, 153, 0);">]</span> grantedAuthorities <span style="color:rgb(51, 153, 51);">=</span> <span style="color:rgb(0, 0, 102);font-weight:bold;">null</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">try</span><span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> user <span style="color:rgb(51, 153, 51);">=</span> userManagerService.<span style="color:rgb(0, 102, 51);">getUser</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">(</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">String</span></a><span style="color:rgb(0, 153, 0);">)</span> authentication.<span style="color:rgb(0, 102, 51);">getPrincipal</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span>, <span style="color:rgb(0, 153, 0);">(</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">String</span></a><span style="color:rgb(0, 153, 0);">)</span> authentication.<span style="color:rgb(0, 102, 51);">getCredentials</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">catch</span><span style="color:rgb(0, 153, 0);">(</span>InvalidCredentialsException ex<span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">throw</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">new</span> BadCredentialsException<span style="color:rgb(0, 153, 0);">(</span>ex.<span style="color:rgb(0, 102, 51);">getMessage</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">catch</span><span style="color:rgb(0, 153, 0);">(</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color:rgb(0, 51, 153);">Exception</span></a> e<span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">throw</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">new</span> AuthenticationServiceException<span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 0, 255);">“Currently we are unable to process your request. Kindly try again later.”</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">if</span> <span style="color:rgb(0, 153, 0);">(</span>user <span style="color:rgb(51, 153, 51);">!=</span> <span style="color:rgb(0, 0, 102);font-weight:bold;">null</span><span style="color:rgb(0, 153, 0);">)</span> <span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> List<span style="color:rgb(51, 153, 51);">&lt;</span>Role<span style="color:rgb(51, 153, 51);">&gt;</span> roles <span style="color:rgb(51, 153, 51);">=</span> user.<span style="color:rgb(0, 102, 51);">getAssociatedRoles</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> grantedAuthorities <span style="color:rgb(51, 153, 51);">=</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">new</span> GrantedAuthority<span style="color:rgb(0, 153, 0);">[</span>roles.<span style="color:rgb(0, 102, 51);">size</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">]</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">for</span> <span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 0, 102);font-weight:bold;">int</span> i <span style="color:rgb(51, 153, 51);">=</span> 0; i <span style="color:rgb(51, 153, 51);">&amp;</span>lt; roles.<span style="color:rgb(0, 102, 51);">size</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span>; i<span style="color:rgb(51, 153, 51);">++</span><span style="color:rgb(0, 153, 0);">)</span> <span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> Role role <span style="color:rgb(51, 153, 51);">=</span> roles.<span style="color:rgb(0, 102, 51);">get</span><span style="color:rgb(0, 153, 0);">(</span>i<span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> GrantedAuthority authority <span style="color:rgb(51, 153, 51);">=</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">new</span> GrantedAuthorityImpl<span style="color:rgb(0, 153, 0);">(</span>role.<span style="color:rgb(0, 102, 51);">getRoleCode</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> grantedAuthorities<span style="color:rgb(0, 153, 0);">[</span>i<span style="color:rgb(0, 153, 0);">]</span> <span style="color:rgb(51, 153, 51);">=</span> authority;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);font-family:monospace;margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">else</span><span style="color:rgb(0, 153, 0);">{</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">throw</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">new</span> BadCredentialsException<span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 0, 255);">“Invalid username/password”</span><span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);margin:0;padding:0;"> <span style="color:rgb(0, 0, 0);font-weight:bold;">return</span> <span style="color:rgb(0, 0, 0);font-weight:bold;">new</span> UsernamePasswordAuthenticationToken<span style="color:rgb(0, 153, 0);">(</span>user, authentication.<span style="color:rgb(0, 102, 51);">getCredentials</span><span style="color:rgb(0, 153, 0);">(</span><span style="color:rgb(0, 153, 0);">)</span>, grantedAuthorities<span style="color:rgb(0, 153, 0);">)</span>;</div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);margin:0;padding:0;"> <span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p>
</p><li>
<div style="font-weight:normal;font-style:normal;color:rgb(0, 0, 32);margin:0;padding:0;"><span style="color:rgb(0, 153, 0);">}</span></div>
</li>
<p></p></ol>
</div>
<p>At the client side (jsp), the simple configuration you need to do is 
post the request to”/j_spring_security_check” with parameters 
“j_username” and “j_password”.</p>
<p>That’s pretty much all you need to do for enabling spring security to
 your existing web application. I will try to explain about doing the 
method security using ACL’s and configuring the view using spring 
security tags in another post.</p>
<div id="jp-post-flair" class="sharedaddy sd-like-enabled"><div class="wpl-likebox sd-block sd-like"><h3 class="sd-title">Like this:</h3><div class="sd-content"><div id="like-3" class="wpl-button "><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?like=1&amp;_wpnonce=539d3ea130" title="I like this." class="like needs-login sd-button" rel="nofollow"><span>Like</span></a></div><div class="wpl-count sd-like-count">Be the first to like this.</div></div></div></div>
						
                        
                        <div class="categories">Posted in: <em><a href="http://tejakantamneni.wordpress.com/category/acegi/" title="View all posts in acegi" rel="category tag">acegi</a>, <a href="http://tejakantamneni.wordpress.com/category/spring-security/" title="View all posts in spring security" rel="category tag">spring security</a>, <a href="http://tejakantamneni.wordpress.com/category/springframework/" title="View all posts in springframework" rel="category tag">springframework</a></em></div>

					</div>

					<div id="nav-below" class="navigation">

						<div class="nav-previous"></div>

						<div class="nav-next"><a href="http://tejakantamneni.wordpress.com/2008/08/24/testing-spring-applications-with-junit-4-and-easy-mock/" rel="next">Testing Spring applications with jUnit 4 and Easy&nbsp;Mock →</a></div>

					</div><!-- #nav-below -->

					<div class="fix"></div>

				</div>

	            <div class="fix"></div>

				<div id="comments">

					

<!-- You can start editing here. -->



	
	<div class="commh2">20 Responses  “Spring Security – Using custom Authentication Processing&nbsp;Filter” → </div>


	<ol class="commentlist snap_preview">

	
        <li class="comment even thread-even depth-1 wrap highlander-comment" id="comment-3">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-false-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/a.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Anonymous<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-3">August 29, 2008</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Nice.  Very helpful.  Thanks for posting this!</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=3#respond" onclick='return addComment.moveForm("comment-3", "3", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment odd alt thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-4">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-false-1" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/a.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Anonymous<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-4">September 1, 2008</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Thanks for a great example of a custom authentication manager!</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=4#respond" onclick='return addComment.moveForm("comment-4", "4", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment even thread-even depth-1 wrap highlander-comment" id="comment-7">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-230840128cc60de286699fcea7af6147-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/230840128cc60de286699fcea7af6147.jpg" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Robert<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-7">November 22, 2008</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>There is some good stuff in here. It doesn’t seem to address my 
dilemma. I am simply trying to read the userId out of a delimited 
cookie. The user has already been authenticated by external systems – no
 password required.</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=7#respond" onclick='return addComment.moveForm("comment-7", "7", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>

<ul class="children">

        <li class="comment odd alt depth-2 wrap highlander-comment" id="comment-28">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-c004e5d6798df435fc74354af8377a69-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/c004e5d6798df435fc74354af8377a69.jpg" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Sumved Shami<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-28">September 15, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Hi Robert</p>
<p>Did you find any answer to this? I also need the same kind of approach but, I did not find any documentation on that.</p>
<p>Thanks in advance.</p>
<p>Regards,<br>
Sumved Shami</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=28#respond" onclick='return addComment.moveForm("comment-28", "28", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>


</ul>


        <li class="comment even thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-9">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-99fc4edf1f47dde6c339c85eeb071e2a-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/99fc4edf1f47dde6c339c85eeb071e2a.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">dibya<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-9">December 30, 2008</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>can i get the entire code for the above sampple ??<br>
I am new to spring security implementation</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=9#respond" onclick='return addComment.moveForm("comment-9", "9", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment odd alt thread-even depth-1 wrap highlander-comment" id="comment-10">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-d4ce883db263cb0eb6d8f4e9a10efa1c-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/d4ce883db263cb0eb6d8f4e9a10efa1c.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Bob<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-10">March 2, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Thanks a lot but i have a question.</p>
<p>After getting the user object i would like to put it in the session so i that i can access it in my jsp page.<br>
Can you explain me how?</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=10#respond" onclick='return addComment.moveForm("comment-10", "10", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment byuser comment-author-tejakantamneni bypostauthor even thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-11">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-5d555c04f1b80fbe575c122979fd25e3-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/5d555c04f1b80fbe575c122979fd25e3.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">tejakantamneni<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-11">March 2, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>you have that object available by default in spring security context. Try using spring security context holder object.</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=11#respond" onclick='return addComment.moveForm("comment-11", "11", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment odd alt thread-even depth-1 wrap highlander-comment" id="comment-14">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-3b418108c4b1fa3b9f6c5b0756ad4ab8-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/3b418108c4b1fa3b9f6c5b0756ad4ab8.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Vijayakumar&gt;KV<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-14">April 1, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Thank you doing this,<br>
I am having Issue which is<br>
 I am using spring default authentication i.e. “j_spring_security_check”
 (must), but i need to log the result information either it success or 
fail in db table, i tryed with filter and listener – but both process 
only if the login success,<br>
So is there any idea to log the login result.</p>
<p>thanks in advance<br>
Vijay</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=14#respond" onclick='return addComment.moveForm("comment-14", "14", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment even thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-17">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-be19457bc092b0e4d9fb527e248e143f-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/be19457bc092b0e4d9fb527e248e143f.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">john<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-17">May 1, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Thanks for good info!</p>
<p>I’m currently using NetBeans 6.5 and glassfishV2, and I’m trying to 
figure out the best security mapping configuration. Is Spring the best 
way to go?</p>
<p>If for example a person shows up at the login.jsp and chooses to sign
 up, and gives a userName and password, how can I save the users 
credentials in my database, and then have the app instantly give them 
permission to a few user.jsp pages?</p>
<p>Thanks..</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=17#respond" onclick='return addComment.moveForm("comment-17", "17", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment odd alt thread-even depth-1 wrap highlander-comment" id="comment-19">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-c7c5af3323b3d057a45aea51a2450d4b-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/c7c5af3323b3d057a45aea51a2450d4b.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Jon Wileman<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-19">May 13, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Hi,<br>
Thanks, this was very useful. I’m new to Spring, and even newer to 
Spring Security, and I’m finding it difficult to find any decent 
tutorials on Spring Security. </p>
<p>It would be good include any import statements in 
CustomAuthunticationManager, as I wasn’t sure which classes were Spring 
specific, and which ones were custom ones e.g. Role, User.</p>
<p>Also, I thought you were going to write a custom login filter, but you used AuthenticationProcessingFilter.</p>
<p>Thanks</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=19#respond" onclick='return addComment.moveForm("comment-19", "19", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment even thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-22">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-2b6755795414811d289ec978ce7de92a-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/2b6755795414811d289ec978ce7de92a.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Benothman<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-22">June 22, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Thanks for this example,<br>
since I start with Spring Security, can you publish the hole code for this example please.</p>
<p>Thanks</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=22#respond" onclick='return addComment.moveForm("comment-22", "22", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment odd alt thread-even depth-1 wrap highlander-comment" id="comment-23">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-d06a0471604f697bd277f166a14ad8cc-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/d06a0471604f697bd277f166a14ad8cc.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Anonymous<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-23">July 1, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Hello, first of all thanks for this example.<br>
It’s so helpfull for people who work with Spring Security that has a non good tutorial…</p>
<p>I have trobules with your implementation.</p>
<p>in CustomAuthenticationManager the Authentication object is not 
populated with the values of the login form. So a 
BadCredentialsException is throwed always.</p>
<p>Is it a j_spring_security_check issue?</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=23#respond" onclick='return addComment.moveForm("comment-23", "23", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment even thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-24">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-d06a0471604f697bd277f166a14ad8cc-1" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/d06a0471604f697bd277f166a14ad8cc.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Anonymous<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-24">July 1, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>I’m the previous user.</p>
<p>The trouble is solved.</p>
<p>The problem is to include in login form the atributtes id &amp; name j_username and j_password in the tags…</p>
<p>Username:<br>
Password: </p>
<p>The only really necesary is to include j_username &amp; j_password in atribute name of the tag.</p>
<p>Greetings!</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=24#respond" onclick='return addComment.moveForm("comment-24", "24", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment odd alt thread-even depth-1 wrap highlander-comment" id="comment-25">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-ccf52b359862ef964ae3503c216476fb-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/ccf52b359862ef964ae3503c216476fb.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment"><a href="http://www.ooober.com/" rel="external nofollow" class="url">hasham</a><br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-25">July 24, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>I finally implement this example in my web application. Nice work tejakantamneni</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=25#respond" onclick='return addComment.moveForm("comment-25", "25", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment even thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-30">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-26f60c1ab8ee2eeb3a7d7c4e70c65986-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/26f60c1ab8ee2eeb3a7d7c4e70c65986.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Erman_TR<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-30">November 15, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Hi Tejakantamneni;<br>
First Thanks for post,<br>
I wonder that what is UserManagerService class?<br>
how can i find this class?<br>
i cant find.<br>
again thank you very much.</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=30#respond" onclick='return addComment.moveForm("comment-30", "30", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>

<ul class="children">

        <li class="comment byuser comment-author-tejakantamneni bypostauthor odd alt depth-2 wrap highlander-comment" id="comment-31">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-5d555c04f1b80fbe575c122979fd25e3-1" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/5d555c04f1b80fbe575c122979fd25e3.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">tejakantamneni<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-31">November 15, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>UserManagerService is your own impl to check against your custom logic to validate a user…</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=31#respond" onclick='return addComment.moveForm("comment-31", "31", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>

<ul class="children">

        <li class="comment even depth-3 wrap highlander-comment" id="comment-32">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-26f60c1ab8ee2eeb3a7d7c4e70c65986-1" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/26f60c1ab8ee2eeb3a7d7c4e70c65986.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Erman_TR<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-32">November 16, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Thank you very much Tejakantamneni;<br>
I have search almost 2 weeks about spring -acegi security and i have found yours better than others but sonething is not clear.<br>
For ex.<br>
user = userManagerService.getUser((String)//user is //org.springframework.security.userdetails.User;???<br>
authentication.getPrincipal(), (String) authentication.getCredentials());//how can you find like this?<br>
//and i want to take a view.. i have not found the way…<br>
if you share make us verry happy.<br>
thanks again.</p>

				
			</div>


		<span class="comm-reply">

		
		
		</span>

		<div class="fix"></div>

	    </li>


</ul>

</ul>


        <li class="comment odd alt thread-even depth-1 wrap highlander-comment" id="comment-33">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-26f60c1ab8ee2eeb3a7d7c4e70c65986-2" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/26f60c1ab8ee2eeb3a7d7c4e70c65986.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Erman_TR<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-33">November 20, 2009</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Thank you very much Tejakantamneni;<br>
I have search almost 2 weeks about spring -acegi security and i have found yours better than others but sonething is not clear.<br>
For ex.<br>
user = userManagerService.getUser((String)//user is //org.springframework.security.userdetails.User;???<br>
authentication.getPrincipal(), (String) authentication.getCredentials());//how can you find like this?<br>
//and i want to take a view.. i have not found the way…<br>
if you share make us verry happy.<br>
thanks again.</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=33#respond" onclick='return addComment.moveForm("comment-33", "33", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment even thread-odd thread-alt depth-1 wrap highlander-comment" id="comment-74">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-feba9408e35d1a5ee160c69bc1e0c339-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/feba9408e35d1a5ee160c69bc1e0c339.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">Theresa<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-74">October 10, 2011</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>Is Role also a custom class? and what should it look like, i can find nothing that explains that.</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=74#respond" onclick='return addComment.moveForm("comment-74", "74", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



        <li class="comment odd alt thread-even depth-1 wrap highlander-comment" id="comment-78">

		    <div class="meta-left">

				<div class="meta-wrap">

					<img id="grav-88d884e4759828f5ec007d9d6eb5774c-0" alt="" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/88d884e4759828f5ec007d9d6eb5774c.png" class="avatar avatar-48 grav-hashed grav-hijack" height="48" width="48"><br>

					<p class="authorcomment">asgar<br></p>

					<p><small><a href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#comment-78">March 2, 2012</a></small></p>

				</div>

			</div>

			<div class="text-right ">

				<p>superb..it is helpful..</p>

				
			</div>


		<span class="comm-reply">

		<a class="comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/?replytocom=78#respond" onclick='return addComment.moveForm("comment-78", "78", "respond", "3")'>Reply</a>
		
		</span>

		<div class="fix"></div>

	    </li>



	</ol>


	
 


								<div class="js" id="respond">
				<h3 id="reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/#respond" style="display:none;">Cancel reply</a></small></h3>
									<form action="http://tejakantamneni.wordpress.com/wp-comments-post.php" method="post" id="commentform">
																										


												
<input name="hc_post_as" id="hc_post_as" value="guest" type="hidden">

<div class="comment-form-field comment-textarea">
	
	<div id="comment-form-comment"><textarea tabindex="-1" style="height: 37px; resize: none; overflow-y: hidden; position: absolute; top: 0px; left: -9999px; width: 588px; line-height: 17px; text-decoration: none; letter-spacing: 0px;" placeholder="Enter your comment here..."></textarea><textarea style="height: 37px; resize: none; overflow-y: hidden;" placeholder="Enter your comment here..." id="comment" name="comment"></textarea></div>
</div>

<div style="display: none;" id="comment-form-identity">

	<div id="comment-form-nascar">
		<p>Fill in your details below or click an icon to log in:</p>
		<ul>
			<li class="selected" style="display:none;">
				<a href="#comment-form-guest" id="postas-guest" title="Guest">
					<span></span>
				</a>
			</li>
			<li>
				<a href="#comment-form-load-service:WordPress.com" id="postas-wordpress" title="WordPress.com">
					<span></span>
				</a>
			</li>
			<li>
				<a href="#comment-form-load-service:Twitter" id="postas-twitter" title="Twitter">
					<span></span>
				</a>
			</li>
			<li>
				<a href="#comment-form-load-service:Facebook" id="postas-facebook" title="Facebook">
					<span></span>
				</a>
			</li>
		</ul>
	</div>

	<div id="comment-form-guest" class="comment-form-service selected">
		<div class="comment-form-padder">
			<div class="comment-form-avatar">
<a href="https://gravatar.com/site/signup/" target="_blank">				<img src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/ad516503a11cd5ca435acc9bb6523536.png" alt="Gravatar" class="no-grav" width="25">
</a>			</div>

				<div class="comment-form-fields">
				<div class="comment-form-field comment-form-email">
					<label for="email">Email <span class="required">(required)</span> <span class="nopublish">(Address never made public)</span></label>
					<div class="comment-form-input"><input id="email" name="email" type="email"></div>
				</div>
				<div class="comment-form-field comment-form-author">
					<label for="author">Name <span class="required">(required)</span></label>
					<div class="comment-form-input"><input id="author" name="author" type="text"></div>
				</div>
				<div class="comment-form-field comment-form-url">
					<label for="url">Website</label>
					<div class="comment-form-input"><input id="url" name="url" type="text"></div>
				</div> 
			</div>
	
		</div>
	</div>

	<div id="comment-form-wordpress" class="comment-form-service">
		<div class="comment-form-padder">
			<div class="comment-form-avatar">
				<img src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/wplogo.png" alt="WordPress.com Logo" class="no-grav" width="25">
			</div>

				<div class="comment-form-fields">
				<input name="wp_avatar" id="wordpress-avatar" class="comment-meta-wordpress" value="" type="hidden">
				<input name="wp_user_id" id="wordpress-user_id" class="comment-meta-wordpress" value="" type="hidden">
				<input name="wp_access_token" id="wordpress-access_token" class="comment-meta-wordpress" value="" type="hidden">
				<p class="comment-form-posting-as pa-wordpress"><strong></strong> You are commenting using your WordPress.com account. <span class="comment-form-log-out">(&nbsp;<a href="javascript:HighlanderComments.doExternalLogout(%20'wordpress'%20);">Log&nbsp;Out</a>&nbsp;/&nbsp;<a href="#" onclick="javascript:HighlanderComments.switchAccount();return false;">Change</a>&nbsp;)</span></p>
			</div>
	
		</div>
	</div>

	<div id="comment-form-twitter" class="comment-form-service">
		<div class="comment-form-padder">
			<div class="comment-form-avatar">
				<img src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/ad516503a11cd5ca435acc9bb6523536.png" alt="Twitter picture" class="no-grav" width="25">
			</div>

				<div class="comment-form-fields">
				<input name="twitter_avatar" id="twitter-avatar" class="comment-meta-twitter" value="" type="hidden">
				<input name="twitter_user_id" id="twitter-user_id" class="comment-meta-twitter" value="" type="hidden">
				<input name="twitter_access_token" id="twitter-access_token" class="comment-meta-twitter" value="" type="hidden">
				<p class="comment-form-posting-as pa-twitter"><strong></strong> You are commenting using your Twitter account. <span class="comment-form-log-out">(&nbsp;<a href="javascript:HighlanderComments.doExternalLogout(%20'twitter'%20);">Log&nbsp;Out</a>&nbsp;/&nbsp;<a href="#" onclick="javascript:HighlanderComments.switchAccount();return false;">Change</a>&nbsp;)</span></p>
			</div>
	
		</div>
	</div>

	<div id="comment-form-facebook" class="comment-form-service">
		<div class="comment-form-padder">
			<div class="comment-form-avatar">
				<img src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/ad516503a11cd5ca435acc9bb6523536.png" alt="Facebook photo" class="no-grav" width="25">
			</div>

				<div class="comment-form-fields">
				<input name="fb_avatar" id="facebook-avatar" class="comment-meta-facebook" value="" type="hidden">
				<input name="fb_user_id" id="facebook-user_id" class="comment-meta-facebook" value="" type="hidden">
				<input name="fb_access_token" id="facebook-access_token" class="comment-meta-facebook" value="" type="hidden">
				<p class="comment-form-posting-as pa-facebook"><strong></strong> You are commenting using your Facebook account. <span class="comment-form-log-out">(&nbsp;<a href="javascript:HighlanderComments.doExternalLogout(%20'facebook'%20);">Log&nbsp;Out</a>&nbsp;/&nbsp;<a href="#" onclick="javascript:HighlanderComments.switchAccount();return false;">Change</a>&nbsp;)</span></p>
			</div>
	
		</div>
	</div>


	<div id="comment-form-load-service" class="comment-form-service">
		<div class="comment-form-posting-as-cancel"><a href="javascript:HighlanderComments.cancelExternalWindow();">Cancel</a></div>
		<p>Connecting to %s</p>
	</div>
	
	
</div>

<script type="text/javascript">
jQuery(document).ready(function(){
	var input = document.createElement( 'input' ),
	    comment = jQuery( '#comment' );

	if ( 'placeholder' in input ) {
		comment.attr( 'placeholder', jQuery( '.comment-textarea label' ).remove().text() );
	}

	// Expando Mode: start small, then auto-resize on first click + text length
	jQuery( '#comment-form-identity' ).hide();
	jQuery( '#comment-form-subscribe' ).hide();
	jQuery( '#commentform .form-submit' ).hide();

	comment.css( { 'height':'10px' } ).one( 'focus', function() {
		var timer = setInterval( HighlanderComments.resizeCallback, 10 )
		jQuery( this ).animate( { 'height': HighlanderComments.initialHeight } ).delay( 100 ).queue( function(n) { clearInterval( timer ); HighlanderComments.resizeCallback(); n(); } );
		jQuery( '#comment-form-identity' ).slideDown();
		jQuery( '#comment-form-subscribe' ).slideDown();
		jQuery( '#commentform .form-submit' ).slideDown();
	});
});
</script>

<div style="display: none;" id="comment-form-subscribe"> 
	<p class="comment-subscription-form"><input name="subscribe" id="subscribe" value="subscribe" style="width: auto;" tabindex="6" type="checkbox"> <label class="subscribe-label" id="subscribe-label" for="subscribe">Notify me of follow-up comments via email.</label></p></div>

												<p style="display: none;" class="form-submit">
							<input name="submit" id="comment-submit" value="Post Comment" type="submit">
							<input name="comment_post_ID" value="3" id="comment_post_ID" type="hidden">
<input name="comment_parent" id="comment_parent" value="0" type="hidden">
						</p>
						
<input name="genseq" value="1350319031" type="hidden">
<p style="display: none;"><input id="akismet_comment_nonce" name="akismet_comment_nonce" value="dc2f2ef1b5" type="hidden"></p><script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/form.js"></script>
<p style="display: none;"><input id="ak_js" name="ak_js" value="1350319036508" type="hidden"></p>					</form>
							</div><!-- #respond -->
			<div style="clear: both"></div>			

				</div>

		
	    
</div><!-- Content -->

<div class="sidebar sidebar_right">
	
    	<div id="search-2" class="widget widget_search"><form role="search" method="get" id="searchform" action="http://tejakantamneni.wordpress.com/">
	<div><label class="screen-reader-text" for="s">Search for:</label>
	<input name="s" id="s" type="text">
	<input id="searchsubmit" value="Search" type="submit">
	</div>
	</form></div><!--/widget--><div id="twitter-2" class="widget widget_twitter"><h3 class="hl"><a href="http://twitter.com/tejakantamneni">Twitter Updates</a></h3><ul class="tweets">
			<li>
				@<a href="http://twitter.com/udaygarikapati">udaygarikapati</a> many happy returns of the day.... 				<a href="http://twitter.com/tejakantamneni/statuses/247684278765379586" class="timesince">4&nbsp;weeks&nbsp;ago</a>
			</li>

			
			<li>
				A Look At How Leica Lenses Are Made <a href="http://flpbd.it/5tEnk"> flpbd.it/5tEnk</a> 				<a href="http://twitter.com/tejakantamneni/statuses/244277417903005696" class="timesince">1&nbsp;month&nbsp;ago</a>
			</li>

			
			<li>
				Etsy unveils its infrastructure (and its Supermicro love) <a href="http://gigaom.com/cloud/etsy-unveils-its-infrastructure-and-its-supermicro-love/"> gigaom.com/cloud/etsy-unv…</a> 				<a href="http://twitter.com/tejakantamneni/statuses/241681641867722752" class="timesince">1&nbsp;month&nbsp;ago</a>
			</li>

			</ul></div><!--/widget-->		<div id="blog-stats" class="widget widget_statscounter">			<h3 class="hl">Blog Stats</h3>			<ul>
			<li>57,145 hits</li>
			</ul>
		</div><!--/widget--><div id="rss_links-3" class="widget widget_rss_links"><h3 class="hl">Subscribe</h3><ul><li><a href="http://tejakantamneni.wordpress.com/feed/" title="Subscribe to Posts">RSS - Posts</a></li><li><a href="http://tejakantamneni.wordpress.com/comments/feed/" title="Subscribe to Comments">RSS - Comments</a></li></ul>
</div><!--/widget--><div id="archives-3" class="widget widget_archive"><h3 class="hl">Archives</h3>		<select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;"> <option selected="selected" value="">Select Month</option> 	<option value="http://tejakantamneni.wordpress.com/2010/08/"> August 2010 &nbsp;(2)</option>
	<option value="http://tejakantamneni.wordpress.com/2008/09/"> September 2008 &nbsp;(2)</option>
	<option value="http://tejakantamneni.wordpress.com/2008/08/"> August 2008 &nbsp;(3)</option>
 </select>
</div><!--/widget-->
</div>

			<div class="footer footer_left">

                <div class="fl"><a href="http://wordpress.com/?ref=footer" rel="generator">Blog at WordPress.com</a>.</div>

				<div class="fr">Theme: <a href="http://theme.wordpress.com/themes/inuit-types/" title="Learn more about this theme">Inuit Types</a> by <a href="http://bizzartic.com/" rel="designer">BizzArtic</a>.</div>

                <div class="fix"><!----></div>

            </div>


    </div>

</div>

<div class="fix"><!----></div>


<script type="text/javascript">
var _qevents = _qevents || [], wpcomQuantcastData = {"qacct":"p-18-mFEk4J448M","labels":",language.en,type.wpcom"};
function wpcomQuantcastPixel( labels, options ) {
	var i, defaults = wpcomQuantcastData, data = { event: 'ajax' };

	labels  = labels  || '';
	options = options || {};

	if ( typeof labels != 'string' )
		options = labels;

	for ( i in defaults ) {
		data[i] = defaults[i];
	}

	for ( i in options ) {
		data[i] = options[i];
	}

	if ( data.labels ) {
		data.labels += ',' + labels;
	} else {
		data.labels = labels;
	}

	_qevents.push( data );
};
(function() {var elem = document.createElement('script');elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";elem.async = true;elem.type = "text/javascript";var scpt = document.getElementsByTagName('script')[0];scpt.parentNode.insertBefore(elem, scpt);  })();
_qevents.push( wpcomQuantcastData );
</script>
<noscript><div style="display: none;"><img src="//pixel.quantserve.com/pixel/p-18-mFEk4J448M.gif?labels=%2Clanguage.en%2Ctype.wpcom" height="1" width="1" alt="" /></div></noscript>


	<script type="text/javascript">
	/* <![CDATA[ */
	(function($){
		$(document).on( 'ready post-load', function() {

			// Remove the login box when clicking the page
			$( document ).mousedown( function( e ) {
				if ( null == $( e.target ).closest( '#wpl-mustlogin' ).get( 0 ) ) {
					$( '#wpl-mustlogin' ).remove();
				}
			});

			// Handle clicking the like button itself
			$('.wpl-button > a.like').click( function(e) {
				e.preventDefault();

				var postid = $(this).parent().attr('id').split('like-')[1];
				$.post( 'http://tejakantamneni.wordpress.com/wp-admin/admin-ajax.php', {
					'action': 'wpl_record_stat',
					'stat_name': 'loggedout_like_click'
				} );

				var tenMins = new Date();
				tenMins.setTime( tenMins.getTime() + 600000 );
				document.cookie = 'wpl_rand=dfe5612b0b; expires=' + tenMins.toGMTString() + '; domain=wordpress.com; path=/;';

				$(this).parent().siblings('.wpl-count').after( '\
					<div id="wpl-mustlogin"> \
						<form action="https://tejakantamneni.wordpress.com/wp-login.php" method="post"> \
							<p>Just one more step to like this:</p> \
							<label><span>Username</span> <input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="80" /></label> \
							<label><span>Password</span> <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="81" /></label> \
							<input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="Log In" tabindex="82" /> \
							<input type="hidden" name="postid" value="' + postid + '" /> \
							<input type="hidden" name="redirect_to" value="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter?year=2008&#038;monthnum=08&#038;day=23&#038;name=spring-security-using-custom-authentication-processing-filter&#038;like=1" /> \
							<input type="hidden" name="wpl_rand" value="dfe5612b0b" /> \
							<p>Not a member yet? <a href="http://wordpress.com/signup/?ref=likebox" id="wpl-signup-link">Sign up with WordPress.com</a></p> \
						</form> \
					</div> \
				');

				$('#wpl-mustlogin').hide().slideDown('fast');
			} );

			$('#wpl-mustlogin input.input').live( 'focus', function() {
				$(this).prev().hide();
			}).live( 'blur', function() {
				if ( $(this).val() == '' ) {
					$(this).prev().show();
				}
			});

			$('#wpl-mustlogin input#wp-submit').live( 'click', function(e) {
				e.preventDefault();

				$.post( 'http://tejakantamneni.wordpress.com/wp-admin/admin-ajax.php', {
					'action': 'wpl_record_stat',
					'stat_name': 'loggedout_login_submit'
				}, function() {
					$('#wpl-mustlogin form').submit();
				} );
			});

			$('#wpl-mustlogin a#wpl-signup-link').live( 'click', function(e) {
				e.preventDefault();

				var link = $(this).attr('href');

				$.post( 'http://tejakantamneni.wordpress.com/wp-admin/admin-ajax.php', {
					'action': 'wpl_record_stat',
					'stat_name': 'loggedout_signup_click'
				}, function() {
					location.href = link;
				} );
			});
		})
	})(jQuery);
	/* ]]> */
	</script>
<script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/gprofiles.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var WPGroHo = {"my_hash":""};
/* ]]> */
</script>
<script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/wpgroho.js"></script>
<script>jQuery(document).ready(function($){ Gravatar.profile_cb = function( h, d ) { WPGroHo.syncProfileData( h, d );	}; Gravatar.my_hash = WPGroHo.my_hash; Gravatar.init( 'body', '#wp-admin-bar-my-account' ); });</script>	<div style="display:none">
	<div class="grofile-hash-map-d41d8cd98f00b204e9800998ecf8427e">
	</div>
	<div class="grofile-hash-map-230840128cc60de286699fcea7af6147">
	</div>
	<div class="grofile-hash-map-c004e5d6798df435fc74354af8377a69">
	</div>
	<div class="grofile-hash-map-99fc4edf1f47dde6c339c85eeb071e2a">
	</div>
	<div class="grofile-hash-map-d4ce883db263cb0eb6d8f4e9a10efa1c">
	</div>
	<div class="grofile-hash-map-5d555c04f1b80fbe575c122979fd25e3">
	</div>
	<div class="grofile-hash-map-3b418108c4b1fa3b9f6c5b0756ad4ab8">
	</div>
	<div class="grofile-hash-map-be19457bc092b0e4d9fb527e248e143f">
	</div>
	<div class="grofile-hash-map-c7c5af3323b3d057a45aea51a2450d4b">
	</div>
	<div class="grofile-hash-map-2b6755795414811d289ec978ce7de92a">
	</div>
	<div class="grofile-hash-map-d06a0471604f697bd277f166a14ad8cc">
	</div>
	<div class="grofile-hash-map-ccf52b359862ef964ae3503c216476fb">
	</div>
	<div class="grofile-hash-map-26f60c1ab8ee2eeb3a7d7c4e70c65986">
	</div>
	<div class="grofile-hash-map-feba9408e35d1a5ee160c69bc1e0c339">
	</div>
	<div class="grofile-hash-map-88d884e4759828f5ec007d9d6eb5774c">
	</div>
	</div>
<script type="text/javascript">
/* <![CDATA[ */
var HighlanderComments = {"loggingInText":"Logging In\u2026","submittingText":"Posting Comment\u2026","postCommentText":"Post Comment","connectingToText":"Connecting to %s","commentingAsText":"%1$s: You are commenting using your %2$s account.","logoutText":"Log Out","loginText":"Log In","connectURL":"http:\/\/tejakantamneni.wordpress.com\/public.api\/connect\/?action=request","logoutURL":"http:\/\/tejakantamneni.wordpress.com\/wp-login.php?action=logout&_wpnonce=263537130a","homeURL":"http:\/\/tejakantamneni.wordpress.com\/","postID":"3","gravDefault":"identicon","enterACommentError":"Please enter a comment","enterEmailError":"Please enter your email address here","invalidEmailError":"Invalid email address","enterAuthorError":"Please enter your name here","gravatarFromEmail":"This picture will show whenever you leave a comment. Click to customize it.","logInToExternalAccount":"Log in to use details from one of these accounts.","change":"Change","changeAccount":"Change Account","comment_registration":"","userIsLoggedIn":"","isJetpack":"0"};
/* ]]> */
</script>
<script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/script.js"></script>

	<div style="bottom: -275px;" id="bit" class="loggedout-follow-normal">
		<a class="bsub" href="javascript:void(0)"><span id="bsub-text">Follow</span></a>
		<div id="bitsubscribe">

					<h3><label for="loggedout-follow-field">Follow “Tejakantamneni's Weblog”</label></h3>

			<form action="https://subscribe.wordpress.com" method="post" accept-charset="utf-8" id="loggedout-follow">
			<p>Get every new post delivered to your Inbox.</p>

			<p id="loggedout-follow-error" style="display: none;"></p>

			
			<p><input name="email" style="width: 95%; padding: 1px 2px" value="Enter your email address" onfocus='this.value=(this.value=="Enter your email address") ? "" : this.value;' onblur='this.value=(this.value=="") ? "Enter email address" : this.value;' id="loggedout-follow-field" type="email"></p>

			<input name="action" value="subscribe" type="hidden">
			<input name="blog_id" value="4605571" type="hidden">
			<input name="source" value="http://tejakantamneni.wordpress.com/2008/08/23/spring-security-using-custom-authentication-processing-filter/" type="hidden">
			<input name="sub-type" value="loggedout-follow" type="hidden">

			<input id="_wpnonce" name="_wpnonce" value="34cc91cafc" type="hidden"><input name="_wp_http_referer" value="/2008/08/23/spring-security-using-custom-authentication-processing-filter/" type="hidden">
			<p id="bsub-subscribe-button"><input value="Sign me up" type="submit"></p>
			</form>
					<div id="bsub-credit"><a href="http://wordpress.com/signup/?ref=lof">Powered by WordPress.com</a></div>
		</div><!-- #bitsubscribe -->
	</div><!-- #bit -->
<script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/widgets.js"></script>
<script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/beacon.js"></script><script type="text/javascript">try{COMSCORE.beacon({c1:2,c2:7518284});}catch(e){}</script><noscript><p class="robots-nocontent"><img src="http://b.scorecardresearch.com/p?cj=1c1=2&#038;c2=7518284" alt="" style="display:none" width="1" height="1" /></p></noscript><script type="text/javascript" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/devicepx.js"></script>
<script type="text/javascript">
// <![CDATA[
(function() {
try{
  if ( window.external &&'msIsSiteMode' in window.external) {
    if (window.external.msIsSiteMode()) {
      var jl = document.createElement('script');
      jl.type='text/javascript';
      jl.async=true;
      jl.src='/wp-content/plugins/ie-sitemode/custom-jumplist.php';
      var s = document.getElementsByTagName('script')[0];
      s.parentNode.insertBefore(jl, s);
    }
  }
}catch(e){}
})();
// ]]>
</script><script src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/w.js" type="text/javascript"></script>
<script type="text/javascript">
st_go({'blog':'4605571','v':'wpcom','user_id':'0','post':'3','subd':'tejakantamneni'});
ex_go({'crypt':'UE40eW5QN0p8M2Y/RE1oOHBqWkJdYy5wL35xRnR4SVtWLmluVHQrZ3JBRDNRaV9yeU4rX041RXBzU1FiayxfJjYsMDhLNmIrWEkxPVkwSy1Mcz96VFBkSnxLdUlOSiU1OW41ajVxMlh3QSVCQy91MFYrVXJpMmxHcmN6TnwlbCs9XXNmSHp8Vzh8ZVtRM2pOVDdILC9senxNWHBndVhUOGRJSFE0JlNjRTNqc2FXM2VCTkRqbUV2JXMxcS8wPzRpU1JCUEJIOWRSSkEsVnZKT2JEc21HTCs0JX50P0NaenZhci8sQlY9Ym0sbVN0bltMRD0yNmVxTyZfbG1XUlJMV05oSG01eVUrNC9YcFdSWytffllrTzA4Qnl3XW9tK19RTGIrLG42dGdTfHQ3b0IvRW1PM0o='});
addLoadEvent(function(){linktracker_init('4605571',3);});
	</script><img id="wpstats" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/g_002.gif" alt=""><img id="wpstats2" src="Spring%20Security%20%E2%80%93%20Using%20custom%20Authentication%20Processing%20Filter%20%C2%AB%20Tejakantamneni%E2%80%99s%20Weblog_arquivos/g.gif" alt="" style="display:none">
<noscript><img src="http://stats.wordpress.com/b.gif?v=noscript" style="height:0px;width:0px;overflow:hidden" alt="" /></noscript>

<!--[if lt IE 7]>
<script src="http://s2.wp.com/wp-content/themes/pub/inuit-types/library/js/IE7.js?m=1315596887g" type="text/javascript"></script>
<![endif]-->


</body></html>